package com.cs.framework.common.exception;

/**
 * 系统的异常类
 * 
 * @author hedongzhou
 * 
 */
public class CSException extends Exception {

	private static final long serialVersionUID = 7783512182462829968L;

	/**
	 * 异常信息编号
	 */
	private String code;

	/**
	 * 异常信息动态内容
	 */
	private Object[] params;

	/**
	 * 异常信息封装类
	 */
	private ExceptionMessage exceptionMessage;

	public CSException(ExceptionMessage exceptionMessage, String code) {
		super(exceptionMessage.getMessage(code));
		this.code = code;
	}

	public CSException(ExceptionMessage exceptionMessage, String code, Object... params) {
		super(exceptionMessage.getMessage(code, params));
		this.code = code;
		this.params = params;
	}

	public CSException(ExceptionMessage exceptionMessage, Throwable cause, String code, Object... params) {
		super(exceptionMessage.getMessage(code, params), cause);
		this.code = code;
		this.params = params;
	}

	public CSException(Throwable cause, ExceptionMessage exceptionMessage, String code, Object... params) {
		super(exceptionMessage.getMessage(code, params), cause);
		this.code = code;
		this.params = params;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Object[] getParams() {
		return params;
	}

	public void setParams(Object[] params) {
		this.params = params;
	}

	public ExceptionMessage getExceptionMessage() {
		return exceptionMessage;
	}

	public void setExceptionMessage(ExceptionMessage exceptionMessage) {
		this.exceptionMessage = exceptionMessage;
	}

}
